/*
 * Created: Author: Ivan Lampert / Date: Jan 25, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-12 00:38:01 -0300 (Fri, 12 Jun 2015) $
 */
package com.cpm.view;

import com.cpm.aggregate.StyleAttribute;
import com.cpm.wrapper.AttributeList;
import com.cpm.wrapper.SolidObjects;
import java.util.Iterator;

public final class Icon {
    
    private final AttributeList<StyleAttribute> attributes = new AttributeList<>();
    private final IconKit icon;
    private final CSSClass[] styleClass;
    
    public Icon(IconKit icon) {
        this(icon, CSSClass.NO_CLASS);
    }
    
    public Icon(IconKit icon, CSSClass... styleClass) {
        SolidObjects.notNullValues(icon, styleClass);
        this.icon = icon;
        this.styleClass = styleClass;
    }

    public final void putAttribute(StyleAttribute attribute) { attributes.putAttribute(attribute); }
    
    public final CSSClass[] getStyleClass() { return this.styleClass; }
    
    public final Iterator getIterator() { return attributes.getIterator(); }
    
    public final String getIconClass() { return icon.getValue(); }

    @Override
    public String toString() {
        String value = icon.getValue();
        
        for (CSSClass styleClas : styleClass) {
            value += " " + styleClas.toString();
        }
        return value;
    }
}